//
//  TiredTableViewCell.m
//  NewMusic
//
//  Created by chuxinyu123 on 15/11/23.
//  Copyright © 2015年 Going. All rights reserved.
//

#import "TiredTableViewCell.h"

@implementation TiredTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self buildInformation];
    }
    return self;
}

- (void)buildInformation
{
    self.titleLabel = [[UILabel alloc] init];
    self.titleLabel.textColor = [UIColor whiteColor];
    self.MVImageView = [[UIImageView alloc] init];
    self.nameLabel = [[UILabel alloc] init];
    self.nameLabel.textColor = [UIColor whiteColor];
    [self.contentView addSubview:_titleLabel];
    [self.contentView addSubview:_nameLabel];
    [self.contentView addSubview:_MVImageView];
    
    [_MVImageView release];
    [_titleLabel release];
    [_nameLabel release];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.MVImageView.frame = CGRectMake(10, 10, self.frame.size.width / 2 - 10, self.frame.size.height - 20);
    self.titleLabel.frame = CGRectMake(_MVImageView.frame.size.width + _MVImageView.frame.origin.x + 10, 20, self.frame.size.width - _MVImageView.frame.size.width - 20, 30);
    self.nameLabel.frame = CGRectMake(_titleLabel.frame.origin.x, _titleLabel.frame.size.height + _titleLabel.frame.origin.y, _titleLabel.frame.size.width, 30);
    self.nameLabel.font = [UIFont systemFontOfSize:15];
}

- (void)setThirdModel:(ThirdModel *)thirdModel
{
    if (_thirdModel != thirdModel) {
        [_thirdModel release];
        _thirdModel = [thirdModel retain];
    }
    self.titleLabel.text = thirdModel.videoName;
    [self.MVImageView sd_setImageWithURL:[NSURL URLWithString:thirdModel.picUrl]];
    self.nameLabel.text = thirdModel.singerName;
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
